home *** CD-ROM | disk | FTP | other *** search
- Path: news1.cris.com!viking!Crawford
- From: Crawford@viking.cris.com (CRAWFORD)
- Newsgroups: comp.lang.c
- Subject: Re: itoa on Unix
- Date: 8 Jan 1996 10:15:39 -0500
- Organization: Concentric Internet Services
- Message-ID: <Crawford.821113489@viking>
- References: <4cra6m$pop@baloo.pipex-sa.net>
- Reply-To: crawford@iac.net
- NNTP-Posting-Host: viking.cris.com
-
- nic@pipex-sa.net (Nic Tjirkalli) writes:
- >I would greatly appreciate it if somebody could inform me of a simple
- >way to convert an integer to a string using gcc on unix.
-
-
- char *itoa (int number)
- {
- static char string[200 + 1];
-
- sprintf (string, "%200d", number);
-
- return string;
- }
-
- char *itoa_r (int number, char *string)
- {
- sprintf (string, %d, number);
-
- return string;
- }
-
- With appropriate headers, naturally.
-
- --
- Creature of the wheel, master of the internal combustion engine.
-
- Robert Crawford crawford@iac.net
- http://www.iac.net/~crawford
-